#!/bin/bash

# 判断用户是否输入了参数
[ $# -eq 0 ] && echo "must be give a canshu" && exit     

# 判断用户输入的参数是否为目录
[ ! -d $1 ] && echo "the $1 is not a directory" && exit

# 遍历目录下的所有文件
for filename in `find $1 -name "*.h" -o -name "*.cpp" -o -name "*.ui"`
do
    # 判断文件中是否包含大写字母，否则跳过进入下一循环,[[:upper:]]可以换成[A-Z]
    if [[ $filename != *[[:upper:]]* ]]; then
        continue
    fi
    new=`echo $filename | tr 'A-Z' 'a-z'`
    mv $filename $new
    echo "the $filename is rename to $new"
done
